package m.jclecai.com.fragment.klpk.pager;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;


import java.util.ArrayList;

import m.jclecai.com.R;
import m.jclecai.com.bean.klpk.bean.PokerBean;
import m.jclecai.com.view.klpk.PagerRecyclerAdapter;
import m.jclecai.com.view.klpk.Poker;

/**
 * Created by andy on 2017/6/6.
 * <p>
 * 对子
 */

public class PairFragment extends BasePagerFragment {


    public class MyAdapter extends PagerRecyclerAdapter {

        public MyAdapter(ArrayList<ArrayList<PokerBean>> listData) {
            super(listData);
        }

        @Override
        protected int getPokerCategory() {
            return Poker.TYPE_PAIRS;
        }

        @Override
        public int getItemLayout() {
            return R.layout.item_poke_pair;
        }
    }

    @Override
    public RecyclerView.LayoutManager getLayoutManager() {
        return new GridLayoutManager(getActivity(), 4) {
            @Override
            public boolean canScrollVertically() {
                return false;
            }
        };
    }

    @Override
    protected ArrayList<ArrayList<PokerBean>> initData() {

        setIndex(0);
        setItemAward(88);
        setSelectAllAward(7);

        mTvSelectedAllRules.setText(getSelectedAllRichText("任选数字,只要开出对子即中奖7元"));

        System.out.println("BaseFragment:任选数字,只要开出对子即中奖7元"+Thread.currentThread().getName());

        ArrayList<ArrayList<PokerBean>> data = new ArrayList<>();
        //这里将13个对子进行一个初始化；
        for (int i = 1; i < 14; i++) {
            ArrayList<PokerBean> pokerBeanList = new ArrayList<>();
            pokerBeanList.add(new PokerBean(PokerBean.Category.box, i));
            pokerBeanList.add(new PokerBean(PokerBean.Category.box, i));

            data.add(pokerBeanList);
        }
        return data;
    }

    @Override
    public PagerRecyclerAdapter getMyAdapter() {
        return new MyAdapter(mListData);
    }

    @Override
    public String getSelectAllTitle() {
        return "对子包选";
    }
}
